<?php
declare (strict_types=1);

namespace app\mall\model;

use think\Model;

/**
 * @mixin Model
 */
class MallCateAttr extends MallBase
{

    /**
     * @param $cate_id
     * @return array|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function buildForSku($cate_id)
    {
        if (!$cate_id) {
            return [];
        }
        return static::where('cate_id', $cate_id)->field(['name', 'value'])->select()->toArray();
    }
}
